package sword_to_1;

import java.util.ArrayList;
import java.util.List;

public class LeeCode_21 {
    public static void main(String[] args) {

    }
    private static int[] exchange(int[] nums) {
        List<Integer> list = new ArrayList<>();
        List<Integer> list2 = new ArrayList<>();
        for (int j : nums) {
            if (j % 2 == 1) {
                list.add(j);
            } else {
                list2.add(j);
            }
        }
        int i = 0;
        for (Integer num : list) {
            nums[i++] = num;
        }
        for (Integer num : list2) {
            nums[i++] = num;
        }
        return nums;
    }
}
